<template>
  <div class="color-panel">
    <div class="el-color-dropdown__main-wrapper">
      <div class="el-color-hue-slider el-color-dropdown__hue-slider"></div>
      <div class="el-color-svpanel el-color-dropdown__panel"></div>
    </div>
    <div class="el-color-dropdown__btns">
      <span class="el-color-dropdown__value">
        <el-input v-model="color" size="mini" placeholder="输入颜色值" />
      </span>
      <el-button size="mini" type="text" class="el-color-dropdown__link-btn"> 取消 </el-button>
      <el-button size="mini" type="primary" class="el-color-dropdown__btn"> 确定 </el-button>
    </div>
  </div>
</template>

<script>
import { ref } from 'vue'
import { ElInput, ElButton } from 'element-plus'

export default {
  name: 'ColorPanel',
  components: {
    ElInput,
    ElButton
  },
  setup() {
    const color = ref('#409EFF')

    return {
      color
    }
  }
}
</script>

<style scoped>
.color-panel {
  width: 280px;
  padding: 10px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  background-color: #fff;
}

.el-color-dropdown__main-wrapper {
  display: flex;
}

.el-color-hue-slider {
  width: 20px;
  height: 200px;
  background: linear-gradient(to bottom, red, yellow, green, cyan, blue, magenta, red);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.el-color-svpanel {
  width: 200px;
  height: 200px;
  margin-left: 10px;
  background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)),
    linear-gradient(to bottom, #000, rgba(0, 0, 0, 0));
  position: relative;
  cursor: pointer;
}

.el-color-dropdown__btns {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.el-color-dropdown__value {
  flex: 1;
  margin-right: 10px;
}
</style>
